import Vue from 'vue'
import Router from 'vue-router'

import productIndex from '@/components/product/ProductIndex'
import MallIndex from '@/components/mall/MallIndex'
import brandIndex from '@/components/brand/brandIndex'
import CompanyProfileIndex from '@/components/companyProfile/CompanyProfileIndex'
import theNewsList from '@/components/news/theNewsList'
import NewsDetails from '@/components/news/NewsDetails'
import NullRouter from '@/components/commonComponents/NullRouter'

Vue.use(Router)

let router = new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'productIndex',
      component: productIndex
    },
    {
      path:'/MallIndex',
      name:'MallIndex',
      component:MallIndex
    },
    {
      path:'/brandIndex',
      name:'brandIndex',
      component:brandIndex
    },
    {
      path:'/CompanyProfileIndex',
      name:'CompanyProfileIndex',
      component:CompanyProfileIndex
    },
    {
      path:'/theNewsList',
      name:'theNewsList',
      component:theNewsList,
    },
    {
      path:'/NewsDetails',
      name:'NewsDetails',
      component:NewsDetails
    },
    {
      path:'/NullRouter',
      name:'NullRouter',
      component:NullRouter
    }

  ]
})
/*router.beforeEach((to, from, next) => {
  if (!/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
    window.location.href = '/'
    return
  }
  next()
})*/

export default router
